cmake_minimum_required(VERSION 3.4.1)

file(GLOB SOURCE ${CMAKE_SOURCE_DIR}/*.cpp )
#导入库文件，和下面target_link_libraries结合编译到native-lib库中
set(lib_path ${CMAKE_SOURCE_DIR}/../../../libs/${ANDROID_ABI})

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L${lib_path}")

#导入头文件 CMAKE_SOURCE_DIR 表示当前CMakeLists文件的目录
include_directories(${CMAKE_SOURCE_DIR}/include)

add_library( # Sets the name of the library.
        native-lib
        SHARED
        ${SOURCE})

find_library( # Sets the name of the path variable.
        log-lib
        log)

target_link_libraries( # Specifies the target library.
        native-lib
#        avcodec avfilter avformat avutil swresample swscale
        #这里要注意，添加有选后顺序，不然会报错
        avfilter avformat avcodec avutil swresample swscale
#        avformat avcodec swscale avutil avfilter swresample
#        或则
#        在这两句话中间，表示忽略顺序，推荐使用这种
#        -Wl,--start-group
#        avcodec avfilter avformat avutil swresample swscale
#        -Wl,--end-group
        ${log-lib}
        z
        OpenSLES
        android)